package com.javen.springbootsecurityjwt.handler;

import com.javen.springbootsecurityjwt.util.ResponseUtil;
import com.javen.springbootsecurityjwt.util.Result;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description: 无权限处理器
 * @Author: tujw
 * @Date: 2022/12/9 17:21
 */
public class SimpleAccessDeniedHandler implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response,
                       AccessDeniedException accessDeniedException) throws IOException, ServletException {
        ResponseUtil.out(response, Result.accessDenied());
    }

}